Ternary 三元運算子


Posted by Rich on 2021-04-22

console.log(10 > 5 ? 'bigger' : 'smaller')
output:bigger

condition ? true : false
條件 ? true就執行 : false就執行


#note







Related Posts

【筆記】 初學Node.js + Express.js 建立簡易餐廳清單

【筆記】 初學Node.js + Express.js 建立簡易餐廳清單

[Note] JS: OOP - Inheritance

[Note] JS: OOP - Inheritance

[Week 1] 認識版本控制與初級 Git 時光機

[Week 1] 認識版本控制與初級 Git 時光機


Comments